/*
 * Copyright (c) 2010 CCX(China) Co.,Ltd. All Rights Reserved.
 *
 * This software is the confidential and proprietary information of
 * CCX(China) Co.,Ltd. ("Confidential Information").
 * It may not be copied or reproduced in any manner without the express 
 * written permission of CCX(China) Co.,Ltd.
 *
 * Author: zhaosj
 * Date: 2010-5-27 下午03:33:37
 */
package com.thread;

/**
 * @author Administrator
 * 
 */
public class Sleep {

	public static void main(String[] args) throws InterruptedException {
		
		final int totals= 3 ;
		
		Thread one1 = new Thread(new Runnable() {
			public void run() {
				for (int i = 0; i < totals; ++i) {
					System.out.print("one ");
					try {
						Thread.sleep(30);
					} catch (InterruptedException e) {
						return;
					}
				}
			}
		});
		
		Thread one2 = new Thread(new Runnable() {
			public void run() {
				for (int i = 0; i < totals; ++i) {
					System.out.print("two ");
					try {
						Thread.sleep(30);
					} catch (InterruptedException e) {
						return;
					}
				}
			}
		});
		
		Thread one3 = new Thread(new Runnable() {
			public void run() {
				for (int i = 0; i < totals; ++i) {
					System.out.print("three ");
					try {
						Thread.sleep(30);
					} catch (InterruptedException e) {
						return;
					}
				}
			}
		});
		
		one1.start();
		one2.start();
		one3.start();

		for (int i = 0; i < 1; ++i) {
			Thread.sleep(100);
			System.out.println();
		}
		
		Thread.currentThread().join();
		
		System.exit(0) ;
	}
	
}
